<template>
  <div class="personCenter-page">

    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>个人中心</el-breadcrumb-item>
    </el-breadcrumb>

    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="基本信息" name="first">
        <baseMsg></baseMsg>
      </el-tab-pane>
      <el-tab-pane label="密码设置" name="second">
        <passwordReset></passwordReset>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  import baseMsg from './subPage/baseMsg'
  import passwordReset from './subPage/passwordReset'

  import {getInfo} from '@/server/personCenter'

  export default {
    components: {
      baseMsg, passwordReset
    },
    data() {
      return {
        activeName: 'first',
        baseData:''
      };
    },
    mounted() {
      // this.getBaseInfo();
    },
    methods: {
      getBaseInfo() {
        getInfo().then((res) => {
          if (res.code == 1) {
           let sData = res.data.datas[0];
           this.baseData = sData;
          } else {
           this.$message(res.message);
          }
        })
      },
      handleClick(tab, event) {
        if (tab.name == 'first') {
          // this.getBaseInfo();
        }
      }
    }
  };
</script>

<style lang="sass">
  .personCenter-page
    padding: 20px
    .el-tabs__content
      width: 50%
      min-width: 300px
      margin: 30px 0
</style>
